package cn.hxth.cloud.provider.handler;

import cn.hxth.cloud.api.common.bean.SpringApplicationContext;
import cn.hxth.cloud.api.common.constant.ProcedureType;
import cn.hxth.cloud.api.domain.ProductionOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ProductionHandlerFactory {
    @Autowired
    private SpringApplicationContext context ;
    public   ProductionHandler getProductionHandler(ProductionOrder productionOrder){
        if(productionOrder.getProcedureType().equals(ProcedureType.COLD)){
            return context.getBean(ColdProductionHandlerManger.class).getProductionHandler(productionOrder) ;
        }
        else {
            return  context.getBean(HeatProductionHandlerManger.class).getProductionHandler(productionOrder) ;
        }
    }
}
